package com.situ.mybatis.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.situ.mybatis.dao.IUserDao;
import com.situ.mybatis.entity.User;
import com.situ.mybatis.util.MyBatisUtil;

public class UserDaoImpl /*implements IUserDao*/{

	//@Override
	public User findById(Integer id) {
		SqlSession sqlSession = MyBatisUtil.getSqlSession();
		//执行sql语句
		User user = sqlSession.selectOne("user.findById", id);
		System.out.println(user);
		return user;
	}

	//@Override
	public List<User> findAll() {
		SqlSession sqlSession = MyBatisUtil.getSqlSession();
		//执行sql语句
		List<User> list = sqlSession.selectList("user.findAll");
		return list;
	}

}
